<?php
$menu = $data['Menu'];
if ($menu['hidden'] == 0) { // dont display hidden record
    return;
}


//CSS for navigation
if ($hasChildren > 0 || $menu['id'] == 7) {
    $this->Tree->addItemAttribute('class', 'dropdown');
}
if ($hasChildren > 0 && $menu['parent_id'] != null) {
    $this->Tree->addItemAttribute('class', 'dropdown-submenu');
}
if ($menu['parent_id'] != null) {
    $this->Tree->addTypeAttribute('class', 'dropdown-menu', null, 'previous');
}

//displaying link
if ($menu['path'] == null) {
    if ($hasChildren > 0 && $menu['parent_id'] == null || $menu['id'] == 7) {
        echo '<a data-toggle="dropdown" href="#">' . $menu['name'] . '<b class="caret"></b></a>';
    } else {
        echo $this->Html->link($menu['name'], '#');
    }
} else {
    echo $this->Html->link($menu['name'], $menu['path']);
}
if ($menu['id'] == 7) {
    echo '<ul class="dropdown-menu">';
    echo $this->element('getCategories');
    echo '</ul>';
}
?>
